package com.squirrel.michale;

/**
 * @author guanhao 观浩
 * @version 1.0.0.0
 * @createTime 2023/2/27 8:57 PM
 * @company Michale Squirrel
 * @link
 * @description
 */
public class LeetCode2149 {

    public int[] rearrangeArray(int[] nums) {
        int n = nums.length;
        int[] arr = new int[n];

        int p1 = 0, p2 = 1;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] > 0) {
                arr[p1] = nums[i];
                p1 += 2;
            } else {
                arr[p2] = nums[i];
                p2 += 2;
            }
        }
        return arr;

    }

//    作者：mumuxinfei
//    链接：https://leetcode.cn/problems/rearrange-array-elements-by-sign/solutions/1597753/by-mumuxinfei-ax0d/
//    来源：力扣（LeetCode）
//    著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。
}
